*Do-file for transgender project on the Swedish rental market:
clear all
version 15.1
set more off

*Set table directory:
local table_folder "C:\Users\jojaac\Dropbox\Personliga saker\Skola\Projekt\1 Sofia thesis\Tables"
*Set appendix table directory:
local appendix_table_folder "C:\Users\jojaac\Dropbox\Personliga saker\Skola\Projekt\1 Sofia thesis\Tables\Online_appendix\"
*Data folder:
local data_folder "C:\Users\jojaac\Dropbox\Personliga saker\Skola\Projekt\1 Sofia thesis\Data"

*Set cd just to be on safe side:
cd "C:\Users\jojaac\Dropbox\Personliga saker\Skola\Projekt\1 Sofia thesis\Data"

*Install necessary packages:
ssc install estout

*Power analysis:
power twomeans 0.45 0.39, sd(0.3) alpha(0.05) power(0.8)

*Read in data:
insheet using "`data_folder'\transgender_data.txt", clear

*Drop variables without values:
drop sentapplication v20
rename v19 comments
rename sent date_apply
rename date date_addup
*Response is a duplicate of invshowgcontact, drop:
rename response positive_response
drop invshowgcontact
*Add zeros to those asking for more information:
replace oskerkringsignal=0 if oskerkringsignal==.
replace bosjlv=0 if bosjlv==.
replace adresserafelnamn=0 if adresserafelnamn==.
*Rescale apartment rent:
replace apartmentrentinsek=apartmentrentinsek/1000

label var apartmentrentinsek "Apartment rent in 1000 SEK"
label var positive_response "Further contact"
label var apartmentareainsqmetres "Apartment area in sq meters"
label var landlord_female "Female landlord"
label var oskerkringsignal "Asking to specify gender"
label var bosjlv "Asking if living on own"
label var adresserafelnamn "Use wrong name"

*Generate dummies for gender identity:
gen cisman=1 if transgender==0 & fem_identity==0
replace cisman=0 if cisman==.
gen ciskvinna=1 if transgender==0 & fem_identity==1
replace ciskvinna=0 if ciskvinna==.
gen transkvinna=1 if transgender==1 & fem_identity==1
replace transkvinna=0 if transkvinna==.
gen transman=1 if transgender==1 & fem_identity==0
replace transman=0 if transman==.

*Generate interactions with landlord being female:
gen transgender_femlandlord=transgender*landlord_female
gen cisman_femlandlord=cisman*landlord_female
gen transman_femlandlord=transman*landlord_female
gen transkvinna_femlandlord=transkvinna*landlord_female
*Interaction with bigger city areas:
gen transgender_metro=transgender*metropolitanarea
gen cisman_metro=cisman*metropolitanarea
gen transman_metro=transman*metropolitanarea
gen transkvinna_metro=transkvinna*metropolitanarea
*Interaction with if landlord is company:
gen transgender_company=transgender*company
gen cisman_company=cisman*company
gen transman_company=transman*company
gen transkvinna_company=transkvinna*company

label var cisman "Cis man"
label var transkvinna "Man-to-woman"
label var transman "Woman-to-man"
label var transgender "Mixed gender signal"
label var transgender_femlandlord "Mixed signal*female landlord"
label var cisman_femlandlord "Cis man*female landlord"
label var transman_femlandlord "Woman-to-man*female landlord"
label var transkvinna_femlandlord "Man-to-woman*female landlord"

label var transgender_metro "Mixed signal*Metropolitan area"
label var cisman_metro "Cis man*Metropolitan area"
label var transman_metro "Woman-to-man*Metropolitan area"
label var transkvinna_metro "Man-to-woman*Metropolitan area"

label var transgender_company "Mixed signal*Company"
label var cisman_company "Cis man*Company"
label var transman_company "Woman-to-man*Company"
label var transkvinna_company "Man-to-woman*Company"




*Test for randomization:
************************
*Two treatments:
*Size:
eststo clear
eststo: reg apartmentareainsqmetres if transgender==1
estadd local identity "Yes"
eststo: reg apartmentareainsqmetres if transgender==0
estadd local identity "No"
eststo: reg apartmentareainsqmetres transgender, robust

esttab using "`table_folder'\randomtest2_sqm.rtf", s(identity N, label("Trans person")) p label title(Randomization test) nostar b(3) replace


*Rooms:
eststo clear
eststo: reg numberofrooms if transgender==1
estadd local identity "Yes"
eststo: reg numberofrooms if transgender==0
estadd local identity "No"
eststo: reg numberofrooms transgender, robust

esttab using "`table_folder'\randomtest2_rooms.rtf", s(identity N, label("Trans person")) p label title(Randomization test) nostar b(3) replace


*Rent:
eststo clear
eststo: reg apartmentrentinsek if transgender==1
estadd local identity "Yes"
eststo: reg apartmentrentinsek if transgender==0
estadd local identity "No"
eststo: reg apartmentrentinsek transgender, robust

esttab using "`table_folder'\randomtest2_rent.rtf", s(identity N, label("Trans person")) p label title(Randomization test) nostar b(3) replace


*Landlord is company:
eststo clear
eststo: reg company if transgender==1
estadd local identity "Yes"
eststo: reg company if transgender==0
estadd local identity "No"
eststo: reg company transgender, robust

esttab using "`table_folder'\randomtest2_company.rtf", s(identity N, label("Trans person")) p label title(Randomization test) nostar b(3) replace


*In metropolitan area:
eststo clear
eststo: reg metropolitanarea if transgender==1
estadd local identity "Yes"
eststo: reg metropolitanarea if transgender==0
estadd local identity "No"
eststo: reg metropolitanarea transgender, robust

esttab using "`table_folder'\randomtest2_metropolitan.rtf", s(identity N, label("Trans person")) p label title(Randomization test) nostar b(3) replace


*Landlord is female:
eststo clear
eststo: reg landlord_female if transgender==1
estadd local identity "Yes"
eststo: reg landlord_female if transgender==0
estadd local identity "No"
eststo: reg landlord_female transgender, robust

esttab using "`table_folder'\randomtest2_femalell.rtf", s(identity N, label("Trans person")) p label title(Randomization test) nostar b(3) replace



*Four treatments:
*Size:
eststo clear
eststo: reg apartmentareainsqmetres if ciskvinna==1
estadd local identity "Cis-woman"
eststo: reg apartmentareainsqmetres if cisman==1
estadd local identity "Cis-man"
eststo: reg apartmentareainsqmetres if transkvinna==1
estadd local identity "Man-to-woman"
eststo: reg apartmentareainsqmetres if transman==1
estadd local identity "Woman-to-man"
eststo: reg apartmentareainsqmetres cisman transkvinna transman, robust
test cisman transkvinna transman
estadd scalar waldp=r(p)

esttab using "`table_folder'\randomtest_sqm.rtf", s(identity waldp N, label("Gender identity")) se label title(Randomization test) nostar b(3) replace


*Rooms:
eststo clear
eststo: reg numberofrooms if ciskvinna==1
estadd local identity "Cis-woman"
eststo: reg numberofrooms if cisman==1
estadd local identity "Cis-man"
eststo: reg numberofrooms if transkvinna==1
estadd local identity "Man-to-woman"
eststo: reg numberofrooms if transman==1
estadd local identity "Woman-to-man"
eststo: reg numberofrooms cisman transkvinna transman, robust
test cisman transkvinna transman
estadd scalar waldp=r(p)

esttab using "`table_folder'\randomtest_rooms.rtf", s(identity waldp N, label("Gender identity")) se label title(Randomization test) nostar b(3) replace


*Rent:
eststo clear
eststo: reg apartmentrentinsek if ciskvinna==1
estadd local identity "Cis-woman"
eststo: reg apartmentrentinsek if cisman==1
estadd local identity "Cis-man"
eststo: reg apartmentrentinsek if transkvinna==1
estadd local identity "Man-to-woman"
eststo: reg apartmentrentinsek if transman==1
estadd local identity "Woman-to-man"
eststo: reg apartmentrentinsek cisman transkvinna transman, robust
test cisman transkvinna transman
estadd scalar waldp=r(p)

esttab using "`table_folder'\randomtest_rent.rtf", s(identity waldp N, label("Gender identity")) se label title(Randomization test) nostar b(3) replace


*Landlord is company:
eststo clear
eststo: reg company if ciskvinna==1
estadd local identity "Cis-woman"
eststo: reg company if cisman==1
estadd local identity "Cis-man"
eststo: reg company if transkvinna==1
estadd local identity "Man-to-woman"
eststo: reg company if transman==1
estadd local identity "Woman-to-man"
eststo: reg company cisman transkvinna transman, robust
test cisman transkvinna transman
estadd scalar waldp=r(p)

esttab using "`table_folder'\randomtest_company.rtf", s(identity waldp N, label("Gender identity")) se label title(Randomization test) nostar b(3) replace


*In metropolitan area:
eststo clear
eststo: reg metropolitanarea if ciskvinna==1
estadd local identity "Cis-woman"
eststo: reg metropolitanarea if cisman==1
estadd local identity "Cis-man"
eststo: reg metropolitanarea if transkvinna==1
estadd local identity "Man-to-woman"
eststo: reg metropolitanarea if transman==1
estadd local identity "Woman-to-man"
eststo: reg metropolitanarea cisman transkvinna transman, robust
test cisman transkvinna transman
estadd scalar waldp=r(p)

esttab using "`table_folder'\randomtest_metropolitan.rtf", s(identity waldp N, label("Gender identity")) se label title(Randomization test) nostar b(3) replace


*Landlord is female:
eststo clear
eststo: reg landlord_female if ciskvinna==1
estadd local identity "Cis-woman"
eststo: reg landlord_female if cisman==1
estadd local identity "Cis-man"
eststo: reg landlord_female if transkvinna==1
estadd local identity "Man-to-woman"
eststo: reg landlord_female if transman==1
estadd local identity "Woman-to-man"
eststo: reg landlord_female cisman transkvinna transman, robust
test cisman transkvinna transman
estadd scalar waldp=r(p)

esttab using "`table_folder'\randomtest_femalell.rtf", s(identity waldp N, label("Gender identity")) se label title(Randomization test) nostar b(3) replace


*Demonstrate that the landlords noticed the signal:
***************************************************
eststo clear
*Difference in security about signal:
eststo: reg oskerkringsignal transgender, robust
estadd local controls "No"
*Adding controls:
eststo: reg oskerkringsignal transgender apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"

esttab using "`table_folder'\notice_signal.rtf", keep(transgender _cons) s(controls N, label("Controls")) se label title(Table 3: Did landlords notice the signal?) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace

*Comparing to women only:
eststo clear
eststo: reg oskerkringsignal transgender cisman, robust
estadd local controls "No"
*Adding controls:
eststo: reg oskerkringsignal transgender cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"

esttab using "`table_folder'\notice_signal_without_cismen.rtf", keep(transgender cisman _cons) s(controls N, label("Controls")) se label title(Table 3: Did landlords notice the signal?) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace

*By identity:
eststo clear
eststo: reg oskerkringsignal transkvinna transman cisman, robust
estadd local controls "No"
*Adding controls:
eststo: reg oskerkringsignal transkvinna transman cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"

esttab using "`table_folder'\notice_signal_identity.rtf", keep(transkvinna transman cisman _cons) s(controls N, label("Controls")) se label title(Table 3: Did landlords notice the signal?) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace




*Produce table of general effect of mixed gender signal:
********************************************************
*Panel comparing mixed to both men and women:
eststo clear
eststo: reg positive_response transgender, robust
estadd local controls "No"
eststo: reg invtoshowing transgender, robust
estadd local controls "No"

eststo: reg positive_response transgender apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
eststo: reg invtoshowing transgender apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"

esttab using "`table_folder'\General_effect.rtf", keep(transgender _cons) s(controls N, label("Controls")) se label title(Table 4: General effect) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Panel where mixed signal is compared to women only, not in pre-analysis plan:
eststo clear
eststo: reg positive_response transgender cisman, robust
estadd local controls "No"
eststo: reg invtoshowing transgender cisman, robust
estadd local controls "No"

eststo: reg positive_response transgender cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
eststo: reg invtoshowing transgender cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"

esttab using "`table_folder'\General_effect_without_cismen.rtf", keep(transgender cisman _cons) s(controls N, label("Controls")) se label title(Table 4: General effect without cis men in the control group) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace



*Produce panel where effect is allowed to vary by gender signal:
eststo clear
eststo: reg positive_response transkvinna transman cisman, robust
estadd local controls "No"
eststo: reg invtoshowing transkvinna transman cisman, robust
estadd local controls "No"
*Add controls:
eststo: reg positive_response transkvinna transman cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
eststo: reg invtoshowing transkvinna transman cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"

esttab using "`table_folder'\Identity_effect.rtf", keep(transkvinna transman cisman _cons) s(controls N, label("Controls")) se label title(Table 4: Effect by identity) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace






*Heterogeneity by large city:
*****************************
*Without controls:
eststo clear
eststo: reg positive_response transgender if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "No"
eststo: reg invtoshowing transgender if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "No"
eststo: reg positive_response transgender if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "No"
eststo: reg invtoshowing transgender if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "No"

esttab using "`table_folder'\General_heteroeffect_city_nocontrols.rtf", keep(transgender _cons) s(area controls N, label("Major city" "Controls")) se label title(Table 5: Effects by metropolitan area without controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Comparing to women only:
eststo clear
eststo: reg positive_response transgender cisman if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "No"
eststo: reg invtoshowing transgender cisman if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "No"
eststo: reg positive_response transgender cisman if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "No"
eststo: reg invtoshowing transgender cisman if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "No"

esttab using "`table_folder'\General_without_cismen_heteroeffect_city_nocontrols.rtf", keep(transgender cisman _cons) s(area controls N, label("Major city" "Controls")) se label title(Table 5: Effects by metropolitan area without controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*By gender signal:
eststo clear
eststo: reg positive_response transkvinna transman cisman if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "No"
eststo: reg invtoshowing transkvinna transman cisman if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "No"
eststo: reg positive_response transkvinna transman cisman if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "No"
eststo: reg invtoshowing transkvinna transman cisman if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "No"

esttab using "`table_folder'\General_identity_heteroeffect_city_nocontrols.rtf", keep(transkvinna transman cisman _cons) s(area controls N, label("Major city" "Controls")) se label title(Table 5: Effects by metropolitan area without controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace







*Additional outcomes, not in pre-analysis plan:
***********************************************
eststo clear
*Ask if living on their own:
eststo: reg bosjlv transgender, robust
estadd local controls "No"
*Use wrong name:
eststo: reg adresserafelnamn transgender, robust
estadd local controls "No"
*Adding controls:
eststo: reg bosjlv transgender apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
eststo: reg adresserafelnamn transgender apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"

esttab  using "`table_folder'\add_outcomes.rtf", keep(transgender _cons) s(controls N, label("Controls")) se label title(Table 5: Additional outcomes) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace

*Compared to women only:
eststo clear
*Ask if living on their own:
eststo: reg bosjlv transgender cisman, robust
estadd local controls "No"
*Use wrong name:
eststo: reg adresserafelnamn transgender cisman, robust
estadd local controls "No"
*Adding controls:
eststo: reg bosjlv transgender cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
eststo: reg adresserafelnamn transgender cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"

esttab  using "`table_folder'\add_outcomes_without_cismen.rtf", keep(transgender cisman _cons) s(controls N, label("Controls")) se label title(Table 5: Additional outcomes) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*All gender signals:
eststo clear
*Ask if living on their own:
eststo: reg bosjlv transkvinna transman cisman, robust
estadd local controls "No"
*Use wrong name:
eststo: reg adresserafelnamn transkvinna transman cisman, robust
estadd local controls "No"
*Adding controls:
eststo: reg bosjlv transkvinna transman cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
eststo: reg adresserafelnamn transkvinna transman cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"

esttab  using "`table_folder'\add_outcomes_identity.rtf", keep(transkvinna transman cisman _cons) s(controls N, label("Controls")) se label title(Table 5: Additional outcomes) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace









***********
*Appendix:*
***********

*Add landlord gender as control instead of company dummy:
*********************************************************'
*Noticing effect:
*****************
eststo clear
eststo: reg oskerkringsignal transgender apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"

esttab using "`appendix_table_folder'\notice_signal_landlord_gender.rtf", keep(transgender _cons) s(controls control_gender N, label("Controls" "Landlord gender control")) se label title(Table A1: Did landlords notice the signal?) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace

*Comparing to women only:
eststo clear
eststo: reg oskerkringsignal transgender cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"

esttab using "`appendix_table_folder'\notice_signal_without_cismen_landlord_gender.rtf", keep(transgender cisman _cons) s(controls control_gender N, label("Controls" "Landlord gender control")) se label title(Table A1: Did landlords notice the signal?) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace

*By identity:
eststo clear
eststo: reg oskerkringsignal transkvinna transman cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"

esttab using "`appendix_table_folder'\notice_signal_identity_landlord_gender.rtf", keep(transkvinna transman cisman _cons) s(controls control_gender N, label("Controls" "Landlord gender control")) se label title(Table A1: Did landlords notice the signal?) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace




*Main effects:
**************
*Panel comparing mixed to both men and women:
eststo clear
eststo: reg positive_response transgender apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"
eststo: reg invtoshowing transgender apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"

esttab using "`appendix_table_folder'\General_effect_landlord_gender.rtf", keep(transgender _cons) s(controls control_gender N, label("Controls" "Landlord gender control")) se label title(Table A.2: Main results – Controlling for female landlord) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Panel where mixed signal is compared to women only, not in pre-analysis plan:
eststo clear
eststo: reg positive_response transgender cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"
eststo: reg invtoshowing transgender cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"

esttab using "`appendix_table_folder'\General_effect_without_cismen_landlord_gender.rtf", keep(transgender cisman _cons) s(controls control_gender N, label("Controls" "Landlord gender control")) se label title(Table A.2: Main results – Controlling for female landlord) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace



*Produce panel where effect is allowed to vary by gender signal:
eststo clear
eststo: reg positive_response transkvinna transman cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"
eststo: reg invtoshowing transkvinna transman cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"

esttab using "`appendix_table_folder'\Identity_effect_landlord_gender.rtf", keep(transkvinna transman cisman _cons) s(controls control_gender N, label("Controls" "Landlord gender control")) se label title(Table A.2: Main results – Controlling for female landlord) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace






*Additional outcomes:
*********************
eststo clear
eststo: reg bosjlv transgender apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"
eststo: reg adresserafelnamn transgender apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"

esttab using "`appendix_table_folder'\add_outcomes_landlord_gender.rtf", keep(transgender _cons) s(controls control_gender N, label("Controls" "Landlord gender control")) se label title(Table A.3: Additional outcomes (not pre-registered) – Controlling for female landlord) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Panel where mixed signal is compared to women only, not in pre-analysis plan:
eststo clear
eststo: reg bosjlv transgender cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"
eststo: reg adresserafelnamn transgender cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"

esttab using "`appendix_table_folder'\add_outcomes_without_cismen_landlord_gender.rtf", keep(transgender cisman _cons) s(controls control_gender N, label("Controls" "Landlord gender control")) se label title(Table A.3: Additional outcomes (not pre-registered) – Controlling for female landlord) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Produce panel where effect is allowed to vary by gender signal:
eststo clear
eststo: reg bosjlv transkvinna transman cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"
eststo: reg adresserafelnamn transkvinna transman cisman apartmentareainsqmetres numberofrooms landlord_female metropolitanarea apartmentrentinsek, robust
estadd local controls "Yes"
estadd local control_gender "Yes"

esttab using "`appendix_table_folder'\add_outcomes_identity_landlord_gender.rtf", keep(transkvinna transman cisman _cons) s(controls control_gender N, label("Controls" "Landlord gender control")) se label title(Table A.3: Additional outcomes (not pre-registered) – Controlling for female landlord) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace






*Controling for use of wrong name:
**********************************
*Panel comparing mixed to both men and women:
eststo clear

eststo: reg positive_response transgender apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek adresserafelnamn, robust
estadd local controls "Yes"
estadd local wrongname "Yes"
eststo: reg invtoshowing transgender apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek adresserafelnamn, robust
estadd local controls "Yes"
estadd local wrongname "Yes"

esttab using "`appendix_table_folder'\General_effect_namecontrol.rtf", keep(transgender _cons) s(controls wrongname N, label("Controls" "Control for using wrong name")) se label title(Table A4: General effect) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Panel where mixed signal is compared to women only, not in pre-analysis plan:
eststo clear

eststo: reg positive_response transgender cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek adresserafelnamn, robust
estadd local controls "Yes"
estadd local wrongname "Yes"
eststo: reg invtoshowing transgender cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek adresserafelnamn, robust
estadd local controls "Yes"
estadd local wrongname "Yes"

esttab using "`appendix_table_folder'\General_effect_without_cismen_namecontrol.rtf", keep(transgender cisman _cons) s(controls wrongname N, label("Controls" "Control for using wrong name")) se label title(Table A4: General effect without cis men in the control group) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace



*Produce panel where effect is allowed to vary by gender signal:
eststo clear

eststo: reg positive_response transkvinna transman cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek adresserafelnamn, robust
estadd local controls "Yes"
estadd local wrongname "Yes"
eststo: reg invtoshowing transkvinna transman cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek adresserafelnamn, robust
estadd local controls "Yes"
estadd local wrongname "Yes"

esttab using "`appendix_table_folder'\Identity_effect_namecontrol.rtf", keep(transkvinna transman cisman _cons) s(controls wrongname N, label("Controls" "Control for using wrong name")) se label title(Table A4: Effect by identity) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace






*Controling for date fixed effects:
***********************************
*Panel comparing mixed to both men and women:
eststo clear

eststo: areg positive_response transgender apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust a(date_apply)
estadd local controls "Yes"
eststo: areg invtoshowing transgender apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust a(date_apply)
estadd local controls "Yes"

esttab using "`appendix_table_folder'\General_effect_datecontrol.rtf", keep(transgender _cons) s(controls N, label("Controls")) se label title(Table A5: General effect) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Panel where mixed signal is compared to women only, not in pre-analysis plan:
eststo clear

eststo: areg positive_response transgender cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust a(date_apply)
estadd local controls "Yes"
eststo: areg invtoshowing transgender cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust a(date_apply)
estadd local controls "Yes"

esttab using "`appendix_table_folder'\General_effect_without_cismen_datecontrol.rtf", keep(transgender cisman _cons) s(controls N, label("Controls")) se label title(Table A5: General effect without cis men in the control group) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace



*Produce panel where effect is allowed to vary by gender signal:
eststo clear

eststo: areg positive_response transkvinna transman cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust a(date_apply)
estadd local controls "Yes"
eststo: areg invtoshowing transkvinna transman cisman apartmentareainsqmetres numberofrooms company metropolitanarea apartmentrentinsek, robust a(date_apply)
estadd local controls "Yes"

esttab using "`appendix_table_folder'\Identity_effect_datecontrol.rtf", keep(transkvinna transman cisman _cons) s(controls N, label("Controls")) se label title(Table A5: Effect by identity) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace









*Heterogeneity by large city:
*****************************
*With controls:
eststo clear
eststo: reg positive_response transgender apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "Yes"
eststo: reg invtoshowing transgender apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "Yes"
eststo: reg positive_response transgender apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "Yes"
eststo: reg invtoshowing transgender apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "Yes"

esttab using "`appendix_table_folder'\General_heteroeffect_city.rtf", keep(transgender _cons) s(area controls N, label("Major city" "Controls")) se label title(Table A.6: Effects by metropolitan area with controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Comparing to women only:
eststo clear
eststo: reg positive_response transgender cisman apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "Yes"
eststo: reg invtoshowing transgender cisman apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "Yes"
eststo: reg positive_response transgender cisman apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "Yes"
eststo: reg invtoshowing transgender cisman apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "Yes"

esttab using "`appendix_table_folder'\General_without_cismen_heteroeffect_city.rtf", keep(transgender cisman _cons) s(area controls N, label("Major city" "Controls")) se label title(Table A.6: Effects by metropolitan area with controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*By gender signal:
eststo clear
eststo: reg positive_response transkvinna transman cisman apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "Yes"
eststo: reg invtoshowing transkvinna transman cisman apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==0, robust
estadd local area "No"
estadd local controls "Yes"
eststo: reg positive_response transkvinna transman cisman apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "Yes"
eststo: reg invtoshowing transkvinna transman cisman apartmentareainsqmetres numberofrooms company apartmentrentinsek if metropolitanarea==1, robust
estadd local area "Yes"
estadd local controls "Yes"

esttab using "`appendix_table_folder'\General_identity_heteroeffect_city.rtf", keep(transkvinna transman cisman _cons) s(area controls N, label("Major city" "Controls")) se label title(Table A.6: Effects by metropolitan area with controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace












*Heterogeneity by landlord gender without controls:
***************************************************
*Table for general effect but by gender of landlord:
eststo clear
eststo: reg positive_response transgender if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "No"
eststo: reg invtoshowing transgender if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "No"
eststo: reg positive_response transgender if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "No"
eststo: reg invtoshowing transgender if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "No"

esttab using "`appendix_table_folder'\General_heteroeffect_nocontrols.rtf", keep(transgender _cons) s(landlord controls N, label("Landlord gender" "Controls")) se label title(Table A.7: Effects by landlord gender without controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Comparing to women only:
eststo clear
eststo: reg positive_response transgender cisman if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "No"
eststo: reg invtoshowing transgender cisman if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "No"
eststo: reg positive_response transgender cisman if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "No"
eststo: reg invtoshowing transgender cisman if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "No"

esttab using "`appendix_table_folder'\General_without_cismen_heteroeffect_nocontrols.rtf", keep(transgender cisman _cons) s(landlord controls N, label("Landlord gender" "Controls")) se label title(Table A.7: Effects by landlord gender without controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*By gender signal:
eststo clear
eststo: reg positive_response transkvinna transman cisman if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "No"
eststo: reg invtoshowing transkvinna transman cisman if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "No"
eststo: reg positive_response transkvinna transman cisman if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "No"
eststo: reg invtoshowing transkvinna transman cisman if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "No"

esttab using "`appendix_table_folder'\General_identity_heteroeffect_nocontrols.rtf", keep(transkvinna transman cisman _cons) s(landlord controls N, label("Landlord gender" "Controls")) se label title(Table A.7: Effects by landlord gender without controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace






*Effect by landlord gender, with controls:
******************************************
*Table for general effect but by gender of landlord:
eststo clear
eststo: reg positive_response transgender apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "Yes"
eststo: reg invtoshowing transgender apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "Yes"
eststo: reg positive_response transgender apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "Yes"
eststo: reg invtoshowing transgender apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "Yes"

esttab using "`appendix_table_folder'\General_heteroeffect.rtf", keep(transgender _cons) s(landlord controls N, label("Landlord gender" "Controls")) se label title(Table A.8: Effects by landlord gender with controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*Comparing to women only:
eststo clear
eststo: reg positive_response transgender cisman apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "Yes"
eststo: reg invtoshowing transgender cisman apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "Yes"
eststo: reg positive_response transgender cisman apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "Yes"
eststo: reg invtoshowing transgender cisman apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "Yes"

esttab using "`appendix_table_folder'\General_without_cismen_heteroeffect.rtf", keep(transgender cisman _cons) s(landlord controls N, label("Landlord gender" "Controls")) se label title(Table A.8: Effects by landlord gender with controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace


*By gender signal:
eststo clear
eststo: reg positive_response transkvinna transman cisman apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "Yes"
eststo: reg invtoshowing transkvinna transman cisman apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==0, robust
estadd local landlord "Male"
estadd local controls "Yes"
eststo: reg positive_response transkvinna transman cisman apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "Yes"
eststo: reg invtoshowing transkvinna transman cisman apartmentareainsqmetres numberofrooms metropolitanarea apartmentrentinsek if landlord_female==1, robust
estadd local landlord "Female"
estadd local controls "Yes"

esttab using "`appendix_table_folder'\General_identity_heteroeffect.rtf", keep(transkvinna transman cisman _cons) s(landlord controls N, label("Landlord gender" "Controls")) se label title(Table A.8: Effects by landlord gender with controls) addnote("Note: Robust standard errors in parenthesis.") star(* 0.10 ** 0.05 *** 0.01) b(3) replace





